// @flow
import React, { Component } from 'react'
import { Button, Popconfirm } from 'antd'
type Props = {
  current: string,
  pageSize: string,
  refreshServerList: Function,
  ignoreMeg: Function,
  order: Function,
  data: Object,
  history: Object
}
type State = {
  displayType: string
}
class ServerListActions extends Component {
  props: Props
  state: State
  ignore: Function
  order: Function
  constructor (props: Props) {
    super(props)
    const { data } = this.props
    if (data.dealType === 0) {
      this.state = {
        displayType: 'block'
      }
    } else {
      this.state = {
        displayType: 'none'
      }
    }
    this.ignore = this.ignore.bind(this)
    this.order = this.order.bind(this)
  }
  ignore () {
    const { data } = this.props
    this.props.ignoreMeg(data)
  }
  order () {
    const { data } = this.props
    this.props.order(data)
  }
  render () {
    // const { history, data } = this.props
    return (
      <div
        style={{ display: this.state.displayType }}>
        <Button
          size='small'
          type='primary'
          style={{ marginRight: '10px' }}
          onClick={this.order}
          >
          生成工单
        </Button>
        {/* <Button
          size='small'
          style={{ marginRight: '10px' }}
          >
          发送消息
        </Button> */}
        <Button
          size='small'
          style={{ marginRight: '10px' }}
          >
          <Popconfirm title='确定忽略？' onConfirm={this.ignore} >
             忽略
          </Popconfirm>
        </Button>
      </div>
    )
  }
}

export default ServerListActions
